How To Build OVMF

Custom bioses for QEMU & UEFI

Home About Projects Blog Games Contact Support

Setup

Linux

!! NOTE !!: This assumes you are using an Ubuntu Linux host to build; I could not get EDKII to build on Alpine Linux.

$ sudo apt-get install build-essential git uuid-dev iasl nasm

$ git clone https://github.com/tianocore/edk2
$ cd edk2

$ git submodule update --init
$ source edksetup.sh
$ make -C BaseTools/

Windows

Building

For X86_64:

  • GCC: build -a X64 -t GCC -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
  • VS Build Tools: build -a X64 -t VS2022 -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
  • Clang (Windows): build -a X64 -t CLANGPDB -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
  • Clang (Linux): build -a X64 -t CLANGDWARF -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc
  • or

    edit file Conf/target.txt: change values for ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc, TARGET = RELEASE, TARGET_ARCH = X64, TOOL_CHAIN_TAG = VS2022

    then run build

    Final output files should be in Build/OvmfPkgX64/RELEASE_GCC/FV/, where RELEASE_GCC matches the e.g. -b RELEASE and -t GCC flags

    Adding/Removing DXE drivers or other customizing

    Edit files OvmfPkg/OvmfPkgX64.dsc and OvmfPkg/OvmfPkgX64.fdf

    For example, to add USB Mouse drivers for "Simple Pointer Protocol" and/or "Absolute Pointer Protocol".

    ! NOTE !: While you can add both simple and absolute pointer protocols, building with both usually has the Simple Pointer protocol "overwrite" the absolute pointer protocol for USB mouse devices. I recommend using one or the other, or building 2 separate OVMF.fd files, 1 for Simple Pointer, and 1 for Absolute Pointer.

    Simple Pointer Protocol:

    Absolute Pointer Protocol: